package csm.web.core.search;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class BriefItem {

	private Map<String, List<String>> items;

	private String title;
	private String author;
	private String publisher;
	private String pubYear;
	private String isbn;
	private String thumbNailUrl;
	private String link;

	private String journalTitle;
	private String issn;

	private String description;
	private String price;


	public BriefItem(){
		items = new HashMap<String, List<String>>();
	}

	public void add(String field, String val){
		List<String> fieldItems;
		if( items.containsKey(field)){
			fieldItems = items.get(field);
			if( !fieldItems.contains(val))
				fieldItems.add(val);
		}
		else{
			fieldItems = new ArrayList<String>();
			fieldItems.add(val);
			items.put(field, fieldItems);
		}
	}

	public List<String> getFieldItems(String field){
		List<String> fieldItems;
		if( items.containsKey(field)){
			fieldItems = items.get(field);
			return fieldItems;
		}
		return new ArrayList<String>(0);
	}

	public String getFieldItemsSigleValue( String field, int index){
		List<String> buffers = getFieldItems(field);
		if( buffers.size() <=0 ) return "";
		return buffers.get(index);
	}

	public Map<String, List<String>> getItems() {
		return items;
	}

	public void setItems(Map<String, List<String>> items) {
		this.items = items;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getAuthor() {
		return author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

	public String getPublisher() {
		return publisher;
	}

	public void setPublisher(String publisher) {
		this.publisher = publisher;
	}

	public String getPubYear() {
		return pubYear;
	}

	public void setPubYear(String pubYear) {
		this.pubYear = pubYear;
	}

	public String getIsbn() {
		return isbn;
	}

	public void setIsbn(String isbn) {
		this.isbn = isbn;
	}

	public String getThumbNailUrl() {
		return thumbNailUrl;
	}

	public void setThumbNailUrl(String thumbNailUrl) {
		this.thumbNailUrl = thumbNailUrl;
	}

	public String getLink() {
		return link;
	}

	public void setLink(String link) {
		this.link = link;
	}

	public String getJournalTitle() {
		return journalTitle;
	}

	public void setJournalTitle(String journalTitle) {
		this.journalTitle = journalTitle;
	}

	public String getIssn() {
		return issn;
	}

	public void setIssn(String issn) {
		this.issn = issn;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getPrice() {
		return price;
	}

	public void setPrice(String price) {
		this.price = price;
	}
}
